import {effect} from "vue"

const a = require("vue@re")

let currentEffect;

class Dep { 
  constructor(val) {
    this.effects = new Set();
    this.val = val;
  }

  getValue() {
    return this._val;
  }

  setValue(newValue) {
    this._val = newValue;
  }

  // 手机依赖
  depend() {
    
  }

  notice() {
    
  }
};

function watchEffect(effect) {
  currentEffect = effect;
  effect();
  currentEffect = null;
}


const dep = new Dep(10);

let b;

watchEffect(() => {
  // 手机依赖
  b = dep.value + 10;
  dep.depend();
  console.log(b)
})

// 触发依赖
dep.value = 1;